package com.example.nonacademic_education.dao;

import com.example.nonacademic_education.entity.Department;
import com.example.nonacademic_education.entity.FileItemInfo;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface FileItemInfoDao {
    List<FileItemInfo> getList(Integer page, Integer size, String name);

    Integer count(String name);

    Integer addOne(FileItemInfo fileItemInfo);

    Integer updateOneById(FileItemInfo fileItemInfo);

    Integer deleteOneById(Long id);

//    @Select("select * from file_item where id in (select fda.file_item_id from fi_dep_association fda where fda.department_id=#{departmentId})")
    @Select("select * from file_item ")
    List<FileItemInfo> getItemList(Long departmentId);

    @Select("select * from file_item where id =#{fileItemId}")
    FileItemInfo getOneById(Long fileItemId);

    @Update("update file_item set file_template_filename=#{filename},file_template_url=#{s} where id =#{fileItemId}")
    Integer updateFilenameAndUrlById(Long fileItemId, String filename, String s);
}
